package org.apple.console;

import java.awt.BasicStroke;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;

import javax.swing.JPanel;

public class BuoyImagePanel extends JPanel {
	Image img = null;
	Image positionImg = null;
	String[] positionInfo = null;

	public BuoyImagePanel(Image image) {
		this.img = image;

	}

	public void setPositionImg(Image image) {
		this.positionImg = image;
		this.positionInfo = "100 200".split(" ");
		//System.out.println("Hello " + this.positionInfo);
	}

	public void setPositionInfo(String data) {
		//this.positionInfo = data.split(" ");
		this.positionInfo = data.split(" ");
		System.out.println("Hello " + this.positionInfo);
	}

	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		Graphics2D g2 = (Graphics2D)g;
		g2.drawImage(img, 0, 0, 400, 600, this);
		g2.setStroke(new BasicStroke(8));

		//g2.setStroke(new BasicStroke(2));

		if (this.positionImg != null) {
			g2.drawImage(positionImg, 300, 0, 100, 100, this);
		}

	}
}
